package org.mspring.mlog.scheduler.job;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * @author Gao Youbo
 */
public abstract class AbstractJob extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        preExecuteInternal(context);
        nativeExecuteInternal(context);
        afterExecuteInternal(context);
    }

    /**
     * JOB执行之前
     *
     * @param context
     */
    protected abstract void preExecuteInternal(JobExecutionContext context);

    /**
     * JOB执行
     *
     * @param context
     */
    protected abstract void nativeExecuteInternal(JobExecutionContext context);

    /**
     * JOB执行之后
     *
     * @param context
     */
    protected abstract void afterExecuteInternal(JobExecutionContext context);
}
